home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Draw / Sources / GroupShp.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  5.1 KB  |  166 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                GroupShp.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Author:                Mary Boetcher
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef GROUPSHP_H
  13. #define GROUPSHP_H
  14.  
  15. #ifndef CONSTANT_H
  16. #include "Constant.h"
  17. #endif
  18.  
  19. #ifndef BASESHP_H
  20. #include "BaseShp.h"
  21. #endif
  22.  
  23. // ----- OS Layer -----
  24.  
  25. #ifndef FWINK_H
  26. #include "FWInk.h"
  27. #endif
  28.  
  29. #ifndef FWSTYLE_H
  30. #include "FWStyle.h"
  31. #endif
  32.  
  33. #ifndef FWPOINT_H
  34. #include "FWPoint.h"
  35. #endif
  36.  
  37. #ifndef FWRECT_H
  38. #include "FWRect.h"
  39. #endif
  40.  
  41. // ----- Foundation Layer -----
  42.  
  43. #ifndef FWRUNTYP_H
  44. #include "FWRunTyp.h"
  45. #endif
  46.  
  47. //========================================================================================
  48. // Forward Declarations
  49. //========================================================================================
  50.  
  51. class ODFacet;
  52. class ODShape;
  53. class CDrawPart;
  54. class FW_CGraphicContext;
  55. class FW_CMouseEvent;
  56.  
  57. class CDrawFacetClipper;
  58. class CUngroupShapesCommand;
  59. class CShapeCollectionIterator;
  60. class CDrawContent;
  61.  
  62. //========================================================================================
  63. // class CGroupShape
  64. //========================================================================================
  65.  
  66. class CGroupShape : public CBaseShape
  67. {
  68.   public:
  69.     FW_DECLARE_CLASS
  70.     FW_DECLARE_AUTO(CGroupShape)
  71.  
  72.   public:
  73.     CGroupShape();
  74.     CGroupShape(CShapeCollection* shapeList);
  75.     CGroupShape(FW_CReadableStream& archive);
  76.     virtual ~CGroupShape();
  77.                 
  78.     // ----- Archiving -----
  79.     static void*         Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  80.     virtual void         Flatten(FW_CWritableStream& archive);
  81.  
  82.     // ----- Required CBaseShape overrides -----
  83.     virtual ODShape*    CreateShapeOutline(Environment* ev);
  84.     virtual void        GetClipRegion(Environment* ev, ODShape* clipRegion);
  85.     virtual void        GetHandleCenter(short whichHandle, FW_CPoint& center) const;
  86.     virtual void        GetMapRects(short whichHandle, const FW_CPoint& lastLocation,
  87.                                     FW_CRect& srcRect, FW_CRect& dstRect);
  88.     virtual FW_CRect    GetRectGeometry() const;
  89.     virtual FW_Boolean    HitTest(Environment* ev, FW_CGraphicContext& gc, const FW_CMouseEvent& theMouseEvent) const;
  90.     virtual void        MapShape(Environment* ev, CDrawPart* part, const FW_CRect& srcRect, const FW_CRect& dstRect);
  91.     virtual void        OffsetShape(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta);
  92.     virtual void        RenderShape(Environment* ev, ODFacet* facet, FW_CGraphicContext& gc);
  93.     virtual void        ResizeFeedback(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, 
  94.                                         short whichHandle, const FW_CPoint& mouseLoc);
  95.     virtual void        SetShapeGeometry(const FW_CPoint& anchorPoint,  const FW_CPoint& currentPoint);
  96.  
  97.     // ----- Other CBaseShape overrides -----
  98.     virtual void        Removed(Environment* ev);
  99.     virtual void         SelectShape(Environment* ev, FW_Boolean state);
  100.     virtual void        SubtractToWindowClip(Environment* ev, 
  101.                                             CDrawFacetClipper* facetClipper, 
  102.                                             ODFacet* containingFacet, 
  103.                                             ODShape* windowClip,
  104.                                             ODShape* tempShape);
  105.  
  106.     virtual void        SetSubscribeLink(Environment* ev, CDrawSubscribeLink* subscribeLink);
  107.  
  108.     // ----- Shape shifting -----
  109.     virtual void        ChangeFrameColor(Environment* ev, CDrawPart* part, const FW_CColor& color);
  110.     virtual void        ChangeFramePattern(Environment* ev, CDrawPart* part, const FW_CPattern& pattern);
  111.     virtual void        ChangeFillColor(Environment* ev, CDrawPart* part, const FW_CColor& color);
  112.     virtual void        ChangeFillPattern(Environment* ev, CDrawPart* part, const FW_CPattern& pattern);
  113.     virtual void        ChangePenSize(Environment* ev, CDrawPart* part, FW_Fixed newPenSize);
  114.     virtual void        ChangeRenderVerb(Environment* ev, CDrawPart* part, unsigned short renderVerb);
  115.  
  116.     // ----- Shape list operations -----
  117.     void                AddShape(CBaseShape* shape);
  118.     unsigned long        CountShapes() const;
  119.     void                EmptyShapes(FW_Boolean deleteShapes);
  120.     CBaseShape*            GetFirstShape() const;
  121.     void                RemoveShapes();
  122.     void                Remove1Shape(CBaseShape* shape);
  123.  
  124.     CShapeCollection*    GetShapeList();
  125.  
  126.   private:
  127.     void                 OutlineShape(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, const FW_CRect& rect);
  128.  
  129.   private:
  130.     CShapeCollection*    fShapeList;    // list of CBaseShape*
  131. };
  132.  
  133. //----------------------------------------------------------------------------------------
  134. inline CShapeCollection* CGroupShape::GetShapeList()
  135. {
  136.     return fShapeList;
  137. }
  138.  
  139. //========================================================================================
  140. //    class CAllShapeIterator - iterate grouped shapes recursively
  141. //========================================================================================
  142.  
  143. class CAllShapeIterator
  144. {
  145.   public:
  146.     FW_DECLARE_AUTO(CAllShapeIterator)
  147.  
  148.     CAllShapeIterator(CShapeCollection* shapeList);
  149.     CAllShapeIterator(CDrawContent* content);
  150.     ~CAllShapeIterator();
  151.  
  152.     CBaseShape*    First();
  153.     CBaseShape*    Next();
  154.     FW_Boolean    IsNotComplete();
  155.  
  156.     unsigned long CountShapes();
  157.  
  158.   private:
  159.     void        PrivFlattenList(CShapeCollection* shapeList);
  160.  
  161.     CShapeCollectionIterator*    fIter;
  162.     CShapeCollection*            fTempList;        // flattened list - temporary
  163. };
  164.  
  165. #endif
  166.